<?php


abstract class BaseDemandePeer {

	
	const DATABASE_NAME = 'opds';

	
	const TABLE_NAME = 'demande';

	
	const CLASS_DEFAULT = 'lib.model.Demande';

	
	const NUM_COLUMNS = 17;

	
	const NUM_LAZY_LOAD_COLUMNS = 0;


	
	const DEMANDE_ID = 'demande.DEMANDE_ID';

	
	const DATE = 'demande.DATE';

	
	const NOM = 'demande.NOM';

	
	const PRENOM = 'demande.PRENOM';

	
	const STATUT_ID = 'demande.STATUT_ID';

	
	const STATUT_AUTRE = 'demande.STATUT_AUTRE';

	
	const ETABLISSEMENT_ID = 'demande.ETABLISSEMENT_ID';

	
	const STRUCTURE_AUTRE = 'demande.STRUCTURE_AUTRE';

	
	const INTITULE_ETUDE = 'demande.INTITULE_ETUDE';

	
	const TYPE_DONNEES_ID = 'demande.TYPE_DONNEES_ID';

	
	const TYPE_DONNEES_AUTRE = 'demande.TYPE_DONNEES_AUTRE';

	
	const PERIODE_DEBUT = 'demande.PERIODE_DEBUT';

	
	const PERIODE_FIN = 'demande.PERIODE_FIN';

	
	const FORMAT_DONNEES_ID = 'demande.FORMAT_DONNEES_ID';

	
	const IS_BESOIN_ASSISTANCE = 'demande.IS_BESOIN_ASSISTANCE';

	
	const TYPE_MOTIVATION_ID = 'demande.TYPE_MOTIVATION_ID';

	
	const COMMENTAIRE = 'demande.COMMENTAIRE';

	
	private static $phpNameMap = null;


	
	private static $fieldNames = array (
		BasePeer::TYPE_PHPNAME => array ('DemandeId', 'Date', 'Nom', 'Prenom', 'StatutId', 'StatutAutre', 'EtablissementId', 'StructureAutre', 'IntituleEtude', 'TypeDonneesId', 'TypeDonneesAutre', 'PeriodeDebut', 'PeriodeFin', 'FormatDonneesId', 'IsBesoinAssistance', 'TypeMotivationId', 'Commentaire', ),
		BasePeer::TYPE_COLNAME => array (DemandePeer::DEMANDE_ID, DemandePeer::DATE, DemandePeer::NOM, DemandePeer::PRENOM, DemandePeer::STATUT_ID, DemandePeer::STATUT_AUTRE, DemandePeer::ETABLISSEMENT_ID, DemandePeer::STRUCTURE_AUTRE, DemandePeer::INTITULE_ETUDE, DemandePeer::TYPE_DONNEES_ID, DemandePeer::TYPE_DONNEES_AUTRE, DemandePeer::PERIODE_DEBUT, DemandePeer::PERIODE_FIN, DemandePeer::FORMAT_DONNEES_ID, DemandePeer::IS_BESOIN_ASSISTANCE, DemandePeer::TYPE_MOTIVATION_ID, DemandePeer::COMMENTAIRE, ),
		BasePeer::TYPE_FIELDNAME => array ('demande_id', 'date', 'nom', 'prenom', 'statut_id', 'statut_autre', 'etablissement_id', 'structure_autre', 'intitule_etude', 'type_donnees_id', 'type_donnees_autre', 'periode_debut', 'periode_fin', 'format_donnees_id', 'is_besoin_assistance', 'type_motivation_id', 'commentaire', ),
		BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, )
	);

	
	private static $fieldKeys = array (
		BasePeer::TYPE_PHPNAME => array ('DemandeId' => 0, 'Date' => 1, 'Nom' => 2, 'Prenom' => 3, 'StatutId' => 4, 'StatutAutre' => 5, 'EtablissementId' => 6, 'StructureAutre' => 7, 'IntituleEtude' => 8, 'TypeDonneesId' => 9, 'TypeDonneesAutre' => 10, 'PeriodeDebut' => 11, 'PeriodeFin' => 12, 'FormatDonneesId' => 13, 'IsBesoinAssistance' => 14, 'TypeMotivationId' => 15, 'Commentaire' => 16, ),
		BasePeer::TYPE_COLNAME => array (DemandePeer::DEMANDE_ID => 0, DemandePeer::DATE => 1, DemandePeer::NOM => 2, DemandePeer::PRENOM => 3, DemandePeer::STATUT_ID => 4, DemandePeer::STATUT_AUTRE => 5, DemandePeer::ETABLISSEMENT_ID => 6, DemandePeer::STRUCTURE_AUTRE => 7, DemandePeer::INTITULE_ETUDE => 8, DemandePeer::TYPE_DONNEES_ID => 9, DemandePeer::TYPE_DONNEES_AUTRE => 10, DemandePeer::PERIODE_DEBUT => 11, DemandePeer::PERIODE_FIN => 12, DemandePeer::FORMAT_DONNEES_ID => 13, DemandePeer::IS_BESOIN_ASSISTANCE => 14, DemandePeer::TYPE_MOTIVATION_ID => 15, DemandePeer::COMMENTAIRE => 16, ),
		BasePeer::TYPE_FIELDNAME => array ('demande_id' => 0, 'date' => 1, 'nom' => 2, 'prenom' => 3, 'statut_id' => 4, 'statut_autre' => 5, 'etablissement_id' => 6, 'structure_autre' => 7, 'intitule_etude' => 8, 'type_donnees_id' => 9, 'type_donnees_autre' => 10, 'periode_debut' => 11, 'periode_fin' => 12, 'format_donnees_id' => 13, 'is_besoin_assistance' => 14, 'type_motivation_id' => 15, 'commentaire' => 16, ),
		BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, )
	);

	
	public static function getMapBuilder()
	{
		return BasePeer::getMapBuilder('lib.model.map.DemandeMapBuilder');
	}
	
	public static function getPhpNameMap()
	{
		if (self::$phpNameMap === null) {
			$map = DemandePeer::getTableMap();
			$columns = $map->getColumns();
			$nameMap = array();
			foreach ($columns as $column) {
				$nameMap[$column->getPhpName()] = $column->getColumnName();
			}
			self::$phpNameMap = $nameMap;
		}
		return self::$phpNameMap;
	}
	
	static public function translateFieldName($name, $fromType, $toType)
	{
		$toNames = self::getFieldNames($toType);
		$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
		if ($key === null) {
			throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
		}
		return $toNames[$key];
	}

	

	static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
	{
		if (!array_key_exists($type, self::$fieldNames)) {
			throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
		}
		return self::$fieldNames[$type];
	}

	
	public static function alias($alias, $column)
	{
		return str_replace(DemandePeer::TABLE_NAME.'.', $alias.'.', $column);
	}

	
	public static function addSelectColumns(Criteria $criteria)
	{

		$criteria->addSelectColumn(DemandePeer::DEMANDE_ID);

		$criteria->addSelectColumn(DemandePeer::DATE);

		$criteria->addSelectColumn(DemandePeer::NOM);

		$criteria->addSelectColumn(DemandePeer::PRENOM);

		$criteria->addSelectColumn(DemandePeer::STATUT_ID);

		$criteria->addSelectColumn(DemandePeer::STATUT_AUTRE);

		$criteria->addSelectColumn(DemandePeer::ETABLISSEMENT_ID);

		$criteria->addSelectColumn(DemandePeer::STRUCTURE_AUTRE);

		$criteria->addSelectColumn(DemandePeer::INTITULE_ETUDE);

		$criteria->addSelectColumn(DemandePeer::TYPE_DONNEES_ID);

		$criteria->addSelectColumn(DemandePeer::TYPE_DONNEES_AUTRE);

		$criteria->addSelectColumn(DemandePeer::PERIODE_DEBUT);

		$criteria->addSelectColumn(DemandePeer::PERIODE_FIN);

		$criteria->addSelectColumn(DemandePeer::FORMAT_DONNEES_ID);

		$criteria->addSelectColumn(DemandePeer::IS_BESOIN_ASSISTANCE);

		$criteria->addSelectColumn(DemandePeer::TYPE_MOTIVATION_ID);

		$criteria->addSelectColumn(DemandePeer::COMMENTAIRE);

	}

	const COUNT = 'COUNT(demande.DEMANDE_ID)';
	const COUNT_DISTINCT = 'COUNT(DISTINCT demande.DEMANDE_ID)';

	
	public static function doCount(Criteria $criteria, $distinct = false, $con = null)
	{
				$criteria = clone $criteria;

				$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(DemandePeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(DemandePeer::COUNT);
		}

				foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$rs = DemandePeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
						return 0;
		}
	}
	
	public static function doSelectOne(Criteria $criteria, $con = null)
	{
		$critcopy = clone $criteria;
		$critcopy->setLimit(1);
		$objects = DemandePeer::doSelect($critcopy, $con);
		if ($objects) {
			return $objects[0];
		}
		return null;
	}
	
	public static function doSelect(Criteria $criteria, $con = null)
	{
		return DemandePeer::populateObjects(DemandePeer::doSelectRS($criteria, $con));
	}
	
	public static function doSelectRS(Criteria $criteria, $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}

		if (!$criteria->getSelectColumns()) {
			$criteria = clone $criteria;
			DemandePeer::addSelectColumns($criteria);
		}

				$criteria->setDbName(self::DATABASE_NAME);

						return BasePeer::doSelect($criteria, $con);
	}
	
	public static function populateObjects(ResultSet $rs)
	{
		$results = array();
	
				$cls = DemandePeer::getOMClass();
		$cls = sfPropel::import($cls);
				while($rs->next()) {
		
			$obj = new $cls();
			$obj->hydrate($rs);
			$results[] = $obj;
			
		}
		return $results;
	}

	
	public static function doCountJoinTypeStatut(Criteria $criteria, $distinct = false, $con = null)
	{
				$criteria = clone $criteria;

				$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(DemandePeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(DemandePeer::COUNT);
		}

				foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$criteria->addJoin(DemandePeer::STATUT_ID, TypeStatutPeer::IDSTATUT);

		$rs = DemandePeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
						return 0;
		}
	}


	
	public static function doCountJoinEtablissement(Criteria $criteria, $distinct = false, $con = null)
	{
				$criteria = clone $criteria;

				$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(DemandePeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(DemandePeer::COUNT);
		}

				foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$criteria->addJoin(DemandePeer::ETABLISSEMENT_ID, EtablissementPeer::IDETABLISSEMENT);

		$rs = DemandePeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
						return 0;
		}
	}


	
	public static function doCountJoinTypeDonnees(Criteria $criteria, $distinct = false, $con = null)
	{
				$criteria = clone $criteria;

				$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(DemandePeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(DemandePeer::COUNT);
		}

				foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$criteria->addJoin(DemandePeer::TYPE_DONNEES_ID, TypeDonneesPeer::IDTYPE_DONNEE);

		$rs = DemandePeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
						return 0;
		}
	}


	
	public static function doCountJoinTypeFormatDonnees(Criteria $criteria, $distinct = false, $con = null)
	{
				$criteria = clone $criteria;

				$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(DemandePeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(DemandePeer::COUNT);
		}

				foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$criteria->addJoin(DemandePeer::FORMAT_DONNEES_ID, TypeFormatDonneesPeer::IDFORMAT_DONNEES);

		$rs = DemandePeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
						return 0;
		}
	}


	
	public static function doCountJoinTypeMotivation(Criteria $criteria, $distinct = false, $con = null)
	{
				$criteria = clone $criteria;

				$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(DemandePeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(DemandePeer::COUNT);
		}

				foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$criteria->addJoin(DemandePeer::TYPE_MOTIVATION_ID, TypeMotivationPeer::IDTYPE_MOTIVATION);

		$rs = DemandePeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
						return 0;
		}
	}


	
	public static function doSelectJoinTypeStatut(Criteria $c, $con = null)
	{
		$c = clone $c;

				if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		DemandePeer::addSelectColumns($c);
		$startcol = (DemandePeer::NUM_COLUMNS - DemandePeer::NUM_LAZY_LOAD_COLUMNS) + 1;
		TypeStatutPeer::addSelectColumns($c);

		$c->addJoin(DemandePeer::STATUT_ID, TypeStatutPeer::IDSTATUT);
		$rs = BasePeer::doSelect($c, $con);
		$results = array();

		while($rs->next()) {

			$omClass = DemandePeer::getOMClass();

			$cls = sfPropel::import($omClass);
			$obj1 = new $cls();
			$obj1->hydrate($rs);

			$omClass = TypeStatutPeer::getOMClass();

			$cls = sfPropel::import($omClass);
			$obj2 = new $cls();
			$obj2->hydrate($rs, $startcol);

			$newObject = true;
			foreach($results as $temp_obj1) {
				$temp_obj2 = $temp_obj1->getTypeStatut(); 				if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
					$newObject = false;
										$temp_obj2->addDemande($obj1); 					break;
				}
			}
			if ($newObject) {
				$obj2->initDemandes();
				$obj2->addDemande($obj1); 			}
			$results[] = $obj1;
		}
		return $results;
	}


	
	public static function doSelectJoinEtablissement(Criteria $c, $con = null)
	{
		$c = clone $c;

				if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		DemandePeer::addSelectColumns($c);
		$startcol = (DemandePeer::NUM_COLUMNS - DemandePeer::NUM_LAZY_LOAD_COLUMNS) + 1;
		EtablissementPeer::addSelectColumns($c);

		$c->addJoin(DemandePeer::ETABLISSEMENT_ID, EtablissementPeer::IDETABLISSEMENT);
		$rs = BasePeer::doSelect($c, $con);
		$results = array();

		while($rs->next()) {

			$omClass = DemandePeer::getOMClass();

			$cls = sfPropel::import($omClass);
			$obj1 = new $cls();
			$obj1->hydrate($rs);

			$omClass = EtablissementPeer::getOMClass();

			$cls = sfPropel::import($omClass);
			$obj2 = new $cls();
			$obj2->hydrate($rs, $startcol);

			$newObject = true;
			foreach($results as $temp_obj1) {
				$temp_obj2 = $temp_obj1->getEtablissement(); 				if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
					$newObject = false;
										$temp_obj2->addDemande($obj1); 					break;
				}
			}
			if ($newObject) {
				$obj2->initDemandes();
				$obj2->addDemande($obj1); 			}
			$results[] = $obj1;
		}
		return $results;
	}


	
	public static function doSelectJoinTypeDonnees(Criteria $c, $con = null)
	{
		$c = clone $c;

				if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		DemandePeer::addSelectColumns($c);
		$startcol = (DemandePeer::NUM_COLUMNS - DemandePeer::NUM_LAZY_LOAD_COLUMNS) + 1;
		TypeDonneesPeer::addSelectColumns($c);

		$c->addJoin(DemandePeer::TYPE_DONNEES_ID, TypeDonneesPeer::IDTYPE_DONNEE);
		$rs = BasePeer::doSelect($c, $con);
		$results = array();

		while($rs->next()) {

			$omClass = DemandePeer::getOMClass();

			$cls = sfPropel::import($omClass);
			$obj1 = new $cls();
			$obj1->hydrate($rs);

			$omClass = TypeDonneesPeer::getOMClass();

			$cls = sfPropel::import($omClass);
			$obj2 = new $cls();
			$obj2->hydrate($rs, $startcol);

			$newObject = true;
			foreach($results as $temp_obj1) {
				$temp_obj2 = $temp_obj1->getTypeDonnees(); 				if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
					$newObject = false;
										$temp_obj2->addDemande($obj1); 					break;
				}
			}
			if ($newObject) {
				$obj2->initDemandes();
				$obj2->addDemande($obj1); 			}
			$results[] = $obj1;
		}
		return $results;
	}


	
	public static function doSelectJoinTypeFormatDonnees(Criteria $c, $con = null)
	{
		$c = clone $c;

				if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		DemandePeer::addSelectColumns($c);
		$startcol = (DemandePeer::NUM_COLUMNS - DemandePeer::NUM_LAZY_LOAD_COLUMNS) + 1;
		TypeFormatDonneesPeer::addSelectColumns($c);

		$c->addJoin(DemandePeer::FORMAT_DONNEES_ID, TypeFormatDonneesPeer::IDFORMAT_DONNEES);
		$rs = BasePeer::doSelect($c, $con);
		$results = array();

		while($rs->next()) {

			$omClass = DemandePeer::getOMClass();

			$cls = sfPropel::import($omClass);
			$obj1 = new $cls();
			$obj1->hydrate($rs);

			$omClass = TypeFormatDonneesPeer::getOMClass();

			$cls = sfPropel::import($omClass);
			$obj2 = new $cls();
			$obj2->hydrate($rs, $startcol);

			$newObject = true;
			foreach($results as $temp_obj1) {
				$temp_obj2 = $temp_obj1->getTypeFormatDonnees(); 				if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
					$newObject = false;
										$temp_obj2->addDemande($obj1); 					break;
				}
			}
			if ($newObject) {
				$obj2->initDemandes();
				$obj2->addDemande($obj1); 			}
			$results[] = $obj1;
		}
		return $results;
	}


	
	public static function doSelectJoinTypeMotivation(Criteria $c, $con = null)
	{
		$c = clone $c;

				if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		DemandePeer::addSelectColumns($c);
		$startcol = (DemandePeer::NUM_COLUMNS - DemandePeer::NUM_LAZY_LOAD_COLUMNS) + 1;
		TypeMotivationPeer::addSelectColumns($c);

		$c->addJoin(DemandePeer::TYPE_MOTIVATION_ID, TypeMotivationPeer::IDTYPE_MOTIVATION);
		$rs = BasePeer::doSelect($c, $con);
		$results = array();

		while($rs->next()) {

			$omClass = DemandePeer::getOMClass();

			$cls = sfPropel::import($omClass);
			$obj1 = new $cls();
			$obj1->hydrate($rs);

			$omClass = TypeMotivationPeer::getOMClass();

			$cls = sfPropel::import($omClass);
			$obj2 = new $cls();
			$obj2->hydrate($rs, $startcol);

			$newObject = true;
			foreach($results as $temp_obj1) {
				$temp_obj2 = $temp_obj1->getTypeMotivation(); 				if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
					$newObject = false;
										$temp_obj2->addDemande($obj1); 					break;
				}
			}
			if ($newObject) {
				$obj2->initDemandes();
				$obj2->addDemande($obj1); 			}
			$results[] = $obj1;
		}
		return $results;
	}


	
	public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
	{
		$criteria = clone $criteria;

				$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(DemandePeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(DemandePeer::COUNT);
		}

				foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$criteria->addJoin(DemandePeer::STATUT_ID, TypeStatutPeer::IDSTATUT);

		$criteria->addJoin(DemandePeer::ETABLISSEMENT_ID, EtablissementPeer::IDETABLISSEMENT);

		$criteria->addJoin(DemandePeer::TYPE_DONNEES_ID, TypeDonneesPeer::IDTYPE_DONNEE);

		$criteria->addJoin(DemandePeer::FORMAT_DONNEES_ID, TypeFormatDonneesPeer::IDFORMAT_DONNEES);

		$criteria->addJoin(DemandePeer::TYPE_MOTIVATION_ID, TypeMotivationPeer::IDTYPE_MOTIVATION);

		$rs = DemandePeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
						return 0;
		}
	}


	
	public static function doSelectJoinAll(Criteria $c, $con = null)
	{
		$c = clone $c;

				if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		DemandePeer::addSelectColumns($c);
		$startcol2 = (DemandePeer::NUM_COLUMNS - DemandePeer::NUM_LAZY_LOAD_COLUMNS) + 1;

		TypeStatutPeer::addSelectColumns($c);
		$startcol3 = $startcol2 + TypeStatutPeer::NUM_COLUMNS;

		EtablissementPeer::addSelectColumns($c);
		$startcol4 = $startcol3 + EtablissementPeer::NUM_COLUMNS;

		TypeDonneesPeer::addSelectColumns($c);
		$startcol5 = $startcol4 + TypeDonneesPeer::NUM_COLUMNS;

		TypeFormatDonneesPeer::addSelectColumns($c);
		$startcol6 = $startcol5 + TypeFormatDonneesPeer::NUM_COLUMNS;

		TypeMotivationPeer::addSelectColumns($c);
		$startcol7 = $startcol6 + TypeMotivationPeer::NUM_COLUMNS;

		$c->addJoin(DemandePeer::STATUT_ID, TypeStatutPeer::IDSTATUT);

		$c->addJoin(DemandePeer::ETABLISSEMENT_ID, EtablissementPeer::IDETABLISSEMENT);

		$c->addJoin(DemandePeer::TYPE_DONNEES_ID, TypeDonneesPeer::IDTYPE_DONNEE);

		$c->addJoin(DemandePeer::FORMAT_DONNEES_ID, TypeFormatDonneesPeer::IDFORMAT_DONNEES);

		$c->addJoin(DemandePeer::TYPE_MOTIVATION_ID, TypeMotivationPeer::IDTYPE_MOTIVATION);

		$rs = BasePeer::doSelect($c, $con);
		$results = array();

		while($rs->next()) {

			$omClass = DemandePeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj1 = new $cls();
			$obj1->hydrate($rs);


					
			$omClass = TypeStatutPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj2 = new $cls();
			$obj2->hydrate($rs, $startcol2);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj2 = $temp_obj1->getTypeStatut(); 				if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
					$newObject = false;
					$temp_obj2->addDemande($obj1); 					break;
				}
			}

			if ($newObject) {
				$obj2->initDemandes();
				$obj2->addDemande($obj1);
			}


					
			$omClass = EtablissementPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj3 = new $cls();
			$obj3->hydrate($rs, $startcol3);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj3 = $temp_obj1->getEtablissement(); 				if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
					$newObject = false;
					$temp_obj3->addDemande($obj1); 					break;
				}
			}

			if ($newObject) {
				$obj3->initDemandes();
				$obj3->addDemande($obj1);
			}


					
			$omClass = TypeDonneesPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj4 = new $cls();
			$obj4->hydrate($rs, $startcol4);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj4 = $temp_obj1->getTypeDonnees(); 				if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
					$newObject = false;
					$temp_obj4->addDemande($obj1); 					break;
				}
			}

			if ($newObject) {
				$obj4->initDemandes();
				$obj4->addDemande($obj1);
			}


					
			$omClass = TypeFormatDonneesPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj5 = new $cls();
			$obj5->hydrate($rs, $startcol5);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj5 = $temp_obj1->getTypeFormatDonnees(); 				if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
					$newObject = false;
					$temp_obj5->addDemande($obj1); 					break;
				}
			}

			if ($newObject) {
				$obj5->initDemandes();
				$obj5->addDemande($obj1);
			}


					
			$omClass = TypeMotivationPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj6 = new $cls();
			$obj6->hydrate($rs, $startcol6);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj6 = $temp_obj1->getTypeMotivation(); 				if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) {
					$newObject = false;
					$temp_obj6->addDemande($obj1); 					break;
				}
			}

			if ($newObject) {
				$obj6->initDemandes();
				$obj6->addDemande($obj1);
			}

			$results[] = $obj1;
		}
		return $results;
	}


	
	public static function doCountJoinAllExceptTypeStatut(Criteria $criteria, $distinct = false, $con = null)
	{
				$criteria = clone $criteria;

				$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(DemandePeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(DemandePeer::COUNT);
		}

				foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$criteria->addJoin(DemandePeer::ETABLISSEMENT_ID, EtablissementPeer::IDETABLISSEMENT);

		$criteria->addJoin(DemandePeer::TYPE_DONNEES_ID, TypeDonneesPeer::IDTYPE_DONNEE);

		$criteria->addJoin(DemandePeer::FORMAT_DONNEES_ID, TypeFormatDonneesPeer::IDFORMAT_DONNEES);

		$criteria->addJoin(DemandePeer::TYPE_MOTIVATION_ID, TypeMotivationPeer::IDTYPE_MOTIVATION);

		$rs = DemandePeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
						return 0;
		}
	}


	
	public static function doCountJoinAllExceptEtablissement(Criteria $criteria, $distinct = false, $con = null)
	{
				$criteria = clone $criteria;

				$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(DemandePeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(DemandePeer::COUNT);
		}

				foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$criteria->addJoin(DemandePeer::STATUT_ID, TypeStatutPeer::IDSTATUT);

		$criteria->addJoin(DemandePeer::TYPE_DONNEES_ID, TypeDonneesPeer::IDTYPE_DONNEE);

		$criteria->addJoin(DemandePeer::FORMAT_DONNEES_ID, TypeFormatDonneesPeer::IDFORMAT_DONNEES);

		$criteria->addJoin(DemandePeer::TYPE_MOTIVATION_ID, TypeMotivationPeer::IDTYPE_MOTIVATION);

		$rs = DemandePeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
						return 0;
		}
	}


	
	public static function doCountJoinAllExceptTypeDonnees(Criteria $criteria, $distinct = false, $con = null)
	{
				$criteria = clone $criteria;

				$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(DemandePeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(DemandePeer::COUNT);
		}

				foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$criteria->addJoin(DemandePeer::STATUT_ID, TypeStatutPeer::IDSTATUT);

		$criteria->addJoin(DemandePeer::ETABLISSEMENT_ID, EtablissementPeer::IDETABLISSEMENT);

		$criteria->addJoin(DemandePeer::FORMAT_DONNEES_ID, TypeFormatDonneesPeer::IDFORMAT_DONNEES);

		$criteria->addJoin(DemandePeer::TYPE_MOTIVATION_ID, TypeMotivationPeer::IDTYPE_MOTIVATION);

		$rs = DemandePeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
						return 0;
		}
	}


	
	public static function doCountJoinAllExceptTypeFormatDonnees(Criteria $criteria, $distinct = false, $con = null)
	{
				$criteria = clone $criteria;

				$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(DemandePeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(DemandePeer::COUNT);
		}

				foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$criteria->addJoin(DemandePeer::STATUT_ID, TypeStatutPeer::IDSTATUT);

		$criteria->addJoin(DemandePeer::ETABLISSEMENT_ID, EtablissementPeer::IDETABLISSEMENT);

		$criteria->addJoin(DemandePeer::TYPE_DONNEES_ID, TypeDonneesPeer::IDTYPE_DONNEE);

		$criteria->addJoin(DemandePeer::TYPE_MOTIVATION_ID, TypeMotivationPeer::IDTYPE_MOTIVATION);

		$rs = DemandePeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
						return 0;
		}
	}


	
	public static function doCountJoinAllExceptTypeMotivation(Criteria $criteria, $distinct = false, $con = null)
	{
				$criteria = clone $criteria;

				$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(DemandePeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(DemandePeer::COUNT);
		}

				foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$criteria->addJoin(DemandePeer::STATUT_ID, TypeStatutPeer::IDSTATUT);

		$criteria->addJoin(DemandePeer::ETABLISSEMENT_ID, EtablissementPeer::IDETABLISSEMENT);

		$criteria->addJoin(DemandePeer::TYPE_DONNEES_ID, TypeDonneesPeer::IDTYPE_DONNEE);

		$criteria->addJoin(DemandePeer::FORMAT_DONNEES_ID, TypeFormatDonneesPeer::IDFORMAT_DONNEES);

		$rs = DemandePeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
						return 0;
		}
	}


	
	public static function doSelectJoinAllExceptTypeStatut(Criteria $c, $con = null)
	{
		$c = clone $c;

								if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		DemandePeer::addSelectColumns($c);
		$startcol2 = (DemandePeer::NUM_COLUMNS - DemandePeer::NUM_LAZY_LOAD_COLUMNS) + 1;

		EtablissementPeer::addSelectColumns($c);
		$startcol3 = $startcol2 + EtablissementPeer::NUM_COLUMNS;

		TypeDonneesPeer::addSelectColumns($c);
		$startcol4 = $startcol3 + TypeDonneesPeer::NUM_COLUMNS;

		TypeFormatDonneesPeer::addSelectColumns($c);
		$startcol5 = $startcol4 + TypeFormatDonneesPeer::NUM_COLUMNS;

		TypeMotivationPeer::addSelectColumns($c);
		$startcol6 = $startcol5 + TypeMotivationPeer::NUM_COLUMNS;

		$c->addJoin(DemandePeer::ETABLISSEMENT_ID, EtablissementPeer::IDETABLISSEMENT);

		$c->addJoin(DemandePeer::TYPE_DONNEES_ID, TypeDonneesPeer::IDTYPE_DONNEE);

		$c->addJoin(DemandePeer::FORMAT_DONNEES_ID, TypeFormatDonneesPeer::IDFORMAT_DONNEES);

		$c->addJoin(DemandePeer::TYPE_MOTIVATION_ID, TypeMotivationPeer::IDTYPE_MOTIVATION);


		$rs = BasePeer::doSelect($c, $con);
		$results = array();

		while($rs->next()) {

			$omClass = DemandePeer::getOMClass();

			$cls = sfPropel::import($omClass);
			$obj1 = new $cls();
			$obj1->hydrate($rs);

			$omClass = EtablissementPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj2  = new $cls();
			$obj2->hydrate($rs, $startcol2);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj2 = $temp_obj1->getEtablissement(); 				if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
					$newObject = false;
					$temp_obj2->addDemande($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj2->initDemandes();
				$obj2->addDemande($obj1);
			}

			$omClass = TypeDonneesPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj3  = new $cls();
			$obj3->hydrate($rs, $startcol3);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj3 = $temp_obj1->getTypeDonnees(); 				if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
					$newObject = false;
					$temp_obj3->addDemande($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj3->initDemandes();
				$obj3->addDemande($obj1);
			}

			$omClass = TypeFormatDonneesPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj4  = new $cls();
			$obj4->hydrate($rs, $startcol4);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj4 = $temp_obj1->getTypeFormatDonnees(); 				if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
					$newObject = false;
					$temp_obj4->addDemande($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj4->initDemandes();
				$obj4->addDemande($obj1);
			}

			$omClass = TypeMotivationPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj5  = new $cls();
			$obj5->hydrate($rs, $startcol5);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj5 = $temp_obj1->getTypeMotivation(); 				if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
					$newObject = false;
					$temp_obj5->addDemande($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj5->initDemandes();
				$obj5->addDemande($obj1);
			}

			$results[] = $obj1;
		}
		return $results;
	}


	
	public static function doSelectJoinAllExceptEtablissement(Criteria $c, $con = null)
	{
		$c = clone $c;

								if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		DemandePeer::addSelectColumns($c);
		$startcol2 = (DemandePeer::NUM_COLUMNS - DemandePeer::NUM_LAZY_LOAD_COLUMNS) + 1;

		TypeStatutPeer::addSelectColumns($c);
		$startcol3 = $startcol2 + TypeStatutPeer::NUM_COLUMNS;

		TypeDonneesPeer::addSelectColumns($c);
		$startcol4 = $startcol3 + TypeDonneesPeer::NUM_COLUMNS;

		TypeFormatDonneesPeer::addSelectColumns($c);
		$startcol5 = $startcol4 + TypeFormatDonneesPeer::NUM_COLUMNS;

		TypeMotivationPeer::addSelectColumns($c);
		$startcol6 = $startcol5 + TypeMotivationPeer::NUM_COLUMNS;

		$c->addJoin(DemandePeer::STATUT_ID, TypeStatutPeer::IDSTATUT);

		$c->addJoin(DemandePeer::TYPE_DONNEES_ID, TypeDonneesPeer::IDTYPE_DONNEE);

		$c->addJoin(DemandePeer::FORMAT_DONNEES_ID, TypeFormatDonneesPeer::IDFORMAT_DONNEES);

		$c->addJoin(DemandePeer::TYPE_MOTIVATION_ID, TypeMotivationPeer::IDTYPE_MOTIVATION);


		$rs = BasePeer::doSelect($c, $con);
		$results = array();

		while($rs->next()) {

			$omClass = DemandePeer::getOMClass();

			$cls = sfPropel::import($omClass);
			$obj1 = new $cls();
			$obj1->hydrate($rs);

			$omClass = TypeStatutPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj2  = new $cls();
			$obj2->hydrate($rs, $startcol2);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj2 = $temp_obj1->getTypeStatut(); 				if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
					$newObject = false;
					$temp_obj2->addDemande($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj2->initDemandes();
				$obj2->addDemande($obj1);
			}

			$omClass = TypeDonneesPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj3  = new $cls();
			$obj3->hydrate($rs, $startcol3);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj3 = $temp_obj1->getTypeDonnees(); 				if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
					$newObject = false;
					$temp_obj3->addDemande($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj3->initDemandes();
				$obj3->addDemande($obj1);
			}

			$omClass = TypeFormatDonneesPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj4  = new $cls();
			$obj4->hydrate($rs, $startcol4);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj4 = $temp_obj1->getTypeFormatDonnees(); 				if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
					$newObject = false;
					$temp_obj4->addDemande($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj4->initDemandes();
				$obj4->addDemande($obj1);
			}

			$omClass = TypeMotivationPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj5  = new $cls();
			$obj5->hydrate($rs, $startcol5);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj5 = $temp_obj1->getTypeMotivation(); 				if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
					$newObject = false;
					$temp_obj5->addDemande($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj5->initDemandes();
				$obj5->addDemande($obj1);
			}

			$results[] = $obj1;
		}
		return $results;
	}


	
	public static function doSelectJoinAllExceptTypeDonnees(Criteria $c, $con = null)
	{
		$c = clone $c;

								if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		DemandePeer::addSelectColumns($c);
		$startcol2 = (DemandePeer::NUM_COLUMNS - DemandePeer::NUM_LAZY_LOAD_COLUMNS) + 1;

		TypeStatutPeer::addSelectColumns($c);
		$startcol3 = $startcol2 + TypeStatutPeer::NUM_COLUMNS;

		EtablissementPeer::addSelectColumns($c);
		$startcol4 = $startcol3 + EtablissementPeer::NUM_COLUMNS;

		TypeFormatDonneesPeer::addSelectColumns($c);
		$startcol5 = $startcol4 + TypeFormatDonneesPeer::NUM_COLUMNS;

		TypeMotivationPeer::addSelectColumns($c);
		$startcol6 = $startcol5 + TypeMotivationPeer::NUM_COLUMNS;

		$c->addJoin(DemandePeer::STATUT_ID, TypeStatutPeer::IDSTATUT);

		$c->addJoin(DemandePeer::ETABLISSEMENT_ID, EtablissementPeer::IDETABLISSEMENT);

		$c->addJoin(DemandePeer::FORMAT_DONNEES_ID, TypeFormatDonneesPeer::IDFORMAT_DONNEES);

		$c->addJoin(DemandePeer::TYPE_MOTIVATION_ID, TypeMotivationPeer::IDTYPE_MOTIVATION);


		$rs = BasePeer::doSelect($c, $con);
		$results = array();

		while($rs->next()) {

			$omClass = DemandePeer::getOMClass();

			$cls = sfPropel::import($omClass);
			$obj1 = new $cls();
			$obj1->hydrate($rs);

			$omClass = TypeStatutPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj2  = new $cls();
			$obj2->hydrate($rs, $startcol2);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj2 = $temp_obj1->getTypeStatut(); 				if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
					$newObject = false;
					$temp_obj2->addDemande($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj2->initDemandes();
				$obj2->addDemande($obj1);
			}

			$omClass = EtablissementPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj3  = new $cls();
			$obj3->hydrate($rs, $startcol3);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj3 = $temp_obj1->getEtablissement(); 				if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
					$newObject = false;
					$temp_obj3->addDemande($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj3->initDemandes();
				$obj3->addDemande($obj1);
			}

			$omClass = TypeFormatDonneesPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj4  = new $cls();
			$obj4->hydrate($rs, $startcol4);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj4 = $temp_obj1->getTypeFormatDonnees(); 				if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
					$newObject = false;
					$temp_obj4->addDemande($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj4->initDemandes();
				$obj4->addDemande($obj1);
			}

			$omClass = TypeMotivationPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj5  = new $cls();
			$obj5->hydrate($rs, $startcol5);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj5 = $temp_obj1->getTypeMotivation(); 				if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
					$newObject = false;
					$temp_obj5->addDemande($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj5->initDemandes();
				$obj5->addDemande($obj1);
			}

			$results[] = $obj1;
		}
		return $results;
	}


	
	public static function doSelectJoinAllExceptTypeFormatDonnees(Criteria $c, $con = null)
	{
		$c = clone $c;

								if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		DemandePeer::addSelectColumns($c);
		$startcol2 = (DemandePeer::NUM_COLUMNS - DemandePeer::NUM_LAZY_LOAD_COLUMNS) + 1;

		TypeStatutPeer::addSelectColumns($c);
		$startcol3 = $startcol2 + TypeStatutPeer::NUM_COLUMNS;

		EtablissementPeer::addSelectColumns($c);
		$startcol4 = $startcol3 + EtablissementPeer::NUM_COLUMNS;

		TypeDonneesPeer::addSelectColumns($c);
		$startcol5 = $startcol4 + TypeDonneesPeer::NUM_COLUMNS;

		TypeMotivationPeer::addSelectColumns($c);
		$startcol6 = $startcol5 + TypeMotivationPeer::NUM_COLUMNS;

		$c->addJoin(DemandePeer::STATUT_ID, TypeStatutPeer::IDSTATUT);

		$c->addJoin(DemandePeer::ETABLISSEMENT_ID, EtablissementPeer::IDETABLISSEMENT);

		$c->addJoin(DemandePeer::TYPE_DONNEES_ID, TypeDonneesPeer::IDTYPE_DONNEE);

		$c->addJoin(DemandePeer::TYPE_MOTIVATION_ID, TypeMotivationPeer::IDTYPE_MOTIVATION);


		$rs = BasePeer::doSelect($c, $con);
		$results = array();

		while($rs->next()) {

			$omClass = DemandePeer::getOMClass();

			$cls = sfPropel::import($omClass);
			$obj1 = new $cls();
			$obj1->hydrate($rs);

			$omClass = TypeStatutPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj2  = new $cls();
			$obj2->hydrate($rs, $startcol2);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj2 = $temp_obj1->getTypeStatut(); 				if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
					$newObject = false;
					$temp_obj2->addDemande($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj2->initDemandes();
				$obj2->addDemande($obj1);
			}

			$omClass = EtablissementPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj3  = new $cls();
			$obj3->hydrate($rs, $startcol3);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj3 = $temp_obj1->getEtablissement(); 				if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
					$newObject = false;
					$temp_obj3->addDemande($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj3->initDemandes();
				$obj3->addDemande($obj1);
			}

			$omClass = TypeDonneesPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj4  = new $cls();
			$obj4->hydrate($rs, $startcol4);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj4 = $temp_obj1->getTypeDonnees(); 				if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
					$newObject = false;
					$temp_obj4->addDemande($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj4->initDemandes();
				$obj4->addDemande($obj1);
			}

			$omClass = TypeMotivationPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj5  = new $cls();
			$obj5->hydrate($rs, $startcol5);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj5 = $temp_obj1->getTypeMotivation(); 				if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
					$newObject = false;
					$temp_obj5->addDemande($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj5->initDemandes();
				$obj5->addDemande($obj1);
			}

			$results[] = $obj1;
		}
		return $results;
	}


	
	public static function doSelectJoinAllExceptTypeMotivation(Criteria $c, $con = null)
	{
		$c = clone $c;

								if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		DemandePeer::addSelectColumns($c);
		$startcol2 = (DemandePeer::NUM_COLUMNS - DemandePeer::NUM_LAZY_LOAD_COLUMNS) + 1;

		TypeStatutPeer::addSelectColumns($c);
		$startcol3 = $startcol2 + TypeStatutPeer::NUM_COLUMNS;

		EtablissementPeer::addSelectColumns($c);
		$startcol4 = $startcol3 + EtablissementPeer::NUM_COLUMNS;

		TypeDonneesPeer::addSelectColumns($c);
		$startcol5 = $startcol4 + TypeDonneesPeer::NUM_COLUMNS;

		TypeFormatDonneesPeer::addSelectColumns($c);
		$startcol6 = $startcol5 + TypeFormatDonneesPeer::NUM_COLUMNS;

		$c->addJoin(DemandePeer::STATUT_ID, TypeStatutPeer::IDSTATUT);

		$c->addJoin(DemandePeer::ETABLISSEMENT_ID, EtablissementPeer::IDETABLISSEMENT);

		$c->addJoin(DemandePeer::TYPE_DONNEES_ID, TypeDonneesPeer::IDTYPE_DONNEE);

		$c->addJoin(DemandePeer::FORMAT_DONNEES_ID, TypeFormatDonneesPeer::IDFORMAT_DONNEES);


		$rs = BasePeer::doSelect($c, $con);
		$results = array();

		while($rs->next()) {

			$omClass = DemandePeer::getOMClass();

			$cls = sfPropel::import($omClass);
			$obj1 = new $cls();
			$obj1->hydrate($rs);

			$omClass = TypeStatutPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj2  = new $cls();
			$obj2->hydrate($rs, $startcol2);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj2 = $temp_obj1->getTypeStatut(); 				if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
					$newObject = false;
					$temp_obj2->addDemande($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj2->initDemandes();
				$obj2->addDemande($obj1);
			}

			$omClass = EtablissementPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj3  = new $cls();
			$obj3->hydrate($rs, $startcol3);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj3 = $temp_obj1->getEtablissement(); 				if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
					$newObject = false;
					$temp_obj3->addDemande($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj3->initDemandes();
				$obj3->addDemande($obj1);
			}

			$omClass = TypeDonneesPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj4  = new $cls();
			$obj4->hydrate($rs, $startcol4);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj4 = $temp_obj1->getTypeDonnees(); 				if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
					$newObject = false;
					$temp_obj4->addDemande($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj4->initDemandes();
				$obj4->addDemande($obj1);
			}

			$omClass = TypeFormatDonneesPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj5  = new $cls();
			$obj5->hydrate($rs, $startcol5);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj5 = $temp_obj1->getTypeFormatDonnees(); 				if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
					$newObject = false;
					$temp_obj5->addDemande($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj5->initDemandes();
				$obj5->addDemande($obj1);
			}

			$results[] = $obj1;
		}
		return $results;
	}


  static public function getUniqueColumnNames()
  {
    return array();
  }
	
	public static function getTableMap()
	{
		return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
	}

	
	public static function getOMClass()
	{
		return DemandePeer::CLASS_DEFAULT;
	}

	
	public static function doInsert($values, $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}

		if ($values instanceof Criteria) {
			$criteria = clone $values; 		} else {
			$criteria = $values->buildCriteria(); 		}

		$criteria->remove(DemandePeer::DEMANDE_ID); 

				$criteria->setDbName(self::DATABASE_NAME);

		try {
									$con->begin();
			$pk = BasePeer::doInsert($criteria, $con);
			$con->commit();
		} catch(PropelException $e) {
			$con->rollback();
			throw $e;
		}

		return $pk;
	}

	
	public static function doUpdate($values, $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}

		$selectCriteria = new Criteria(self::DATABASE_NAME);

		if ($values instanceof Criteria) {
			$criteria = clone $values; 
			$comparison = $criteria->getComparison(DemandePeer::DEMANDE_ID);
			$selectCriteria->add(DemandePeer::DEMANDE_ID, $criteria->remove(DemandePeer::DEMANDE_ID), $comparison);

		} else { 			$criteria = $values->buildCriteria(); 			$selectCriteria = $values->buildPkeyCriteria(); 		}

				$criteria->setDbName(self::DATABASE_NAME);

		return BasePeer::doUpdate($selectCriteria, $criteria, $con);
	}

	
	public static function doDeleteAll($con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}
		$affectedRows = 0; 		try {
									$con->begin();
			$affectedRows += BasePeer::doDeleteAll(DemandePeer::TABLE_NAME, $con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	 public static function doDelete($values, $con = null)
	 {
		if ($con === null) {
			$con = Propel::getConnection(DemandePeer::DATABASE_NAME);
		}

		if ($values instanceof Criteria) {
			$criteria = clone $values; 		} elseif ($values instanceof Demande) {

			$criteria = $values->buildPkeyCriteria();
		} else {
						$criteria = new Criteria(self::DATABASE_NAME);
			$criteria->add(DemandePeer::DEMANDE_ID, (array) $values, Criteria::IN);
		}

				$criteria->setDbName(self::DATABASE_NAME);

		$affectedRows = 0; 
		try {
									$con->begin();
			
			$affectedRows += BasePeer::doDelete($criteria, $con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public static function doValidate(Demande $obj, $cols = null)
	{
		$columns = array();

		if ($cols) {
			$dbMap = Propel::getDatabaseMap(DemandePeer::DATABASE_NAME);
			$tableMap = $dbMap->getTable(DemandePeer::TABLE_NAME);

			if (! is_array($cols)) {
				$cols = array($cols);
			}

			foreach($cols as $colName) {
				if ($tableMap->containsColumn($colName)) {
					$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
					$columns[$colName] = $obj->$get();
				}
			}
		} else {

		}

		$res =  BasePeer::doValidate(DemandePeer::DATABASE_NAME, DemandePeer::TABLE_NAME, $columns);
    if ($res !== true) {
        $request = sfContext::getInstance()->getRequest();
        foreach ($res as $failed) {
            $col = DemandePeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
            $request->setError($col, $failed->getMessage());
        }
    }

    return $res;
	}

	
	public static function retrieveByPK($pk, $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}

		$criteria = new Criteria(DemandePeer::DATABASE_NAME);

		$criteria->add(DemandePeer::DEMANDE_ID, $pk);


		$v = DemandePeer::doSelect($criteria, $con);

		return !empty($v) > 0 ? $v[0] : null;
	}

	
	public static function retrieveByPKs($pks, $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}

		$objs = null;
		if (empty($pks)) {
			$objs = array();
		} else {
			$criteria = new Criteria();
			$criteria->add(DemandePeer::DEMANDE_ID, $pks, Criteria::IN);
			$objs = DemandePeer::doSelect($criteria, $con);
		}
		return $objs;
	}

} 
if (Propel::isInit()) {
			try {
		BaseDemandePeer::getMapBuilder();
	} catch (Exception $e) {
		Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
	}
} else {
			Propel::registerMapBuilder('lib.model.map.DemandeMapBuilder');
}
